/**
 * 
 */
package com.gopay.bis.ceb.ebank.impl;

import java.util.Map;

import com.gopay.bis.ceb.ebank.operation.CebB2cQueryHelper;
import com.gopay.common.domain.bank.BaseMessage;
import com.gopay.common.domain.bank.ceb.ebank.CebB2cMessage;
import com.gopay.common.exception.GopayException;
import com.gopay.remote.bank.ICertHelper;
import com.gopay.remote.bank.businesses.BankService;

/**
 * @CebB2cBankServiceImpl.java
 * @author Ryan
 * @2013-11-28 上午10:40:10 www.gopay.com.cn Inc.All rights reserved.
 */
public class CebB2cBankServiceImpl implements BankService {

	private ICertHelper cebB2cCertHelper;

	private CebB2cQueryHelper cebB2cQueryHelper;

	public Object sign(BaseMessage msg) throws GopayException {
		return cebB2cCertHelper.sign(msg);
	}

	public Object verify(BaseMessage msg) throws GopayException {
		return cebB2cCertHelper.verify(msg);
	}

	public Object query(Object obj) throws GopayException {
		CebB2cMessage cebB2cMessage = (CebB2cMessage) obj;
		cebB2cCertHelper.sign(cebB2cMessage);
		Map<String, String> param = cebB2cQueryHelper
				.buildQueryParam(cebB2cMessage);
		String queryResult = (String) cebB2cQueryHelper.query(param);
		CebB2cMessage message = cebB2cQueryHelper.parseMessage(queryResult);
		return message;
	}

	/**
	 * @return the cebB2cCertHelper
	 */
	public ICertHelper getCebB2cCertHelper() {
		return cebB2cCertHelper;
	}

	/**
	 * @param cebB2cCertHelper
	 *            the cebB2cCertHelper to set
	 */
	public void setCebB2cCertHelper(ICertHelper cebB2cCertHelper) {
		this.cebB2cCertHelper = cebB2cCertHelper;
	}

	/**
	 * @return the cebB2cQueryHelper
	 */
	public CebB2cQueryHelper getCebB2cQueryHelper() {
		return cebB2cQueryHelper;
	}

	/**
	 * @param cebB2cQueryHelper
	 *            the cebB2cQueryHelper to set
	 */
	public void setCebB2cQueryHelper(CebB2cQueryHelper cebB2cQueryHelper) {
		this.cebB2cQueryHelper = cebB2cQueryHelper;
	}

	@Override
	public Object dayend(Object obj) throws GopayException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object refund(Object obj) throws GopayException {
		// TODO Auto-generated method stub
		return null;
	}

}
